// Fill out your copyright notice in the Description page of Project Settings.


#include "UserWidget/SingleTabButtonWidget.h"
#include "Components/TextBlock.h"
#include "Components/Border.h"

void USingleTabButtonWidget::NativeOnInitialized() {
	Super::NativeOnInitialized();
	Label = FText::FromString("Quests");
	IsSelected = false;
}

void USingleTabButtonWidget::NativePreConstruct() {
	Super::NativePreConstruct();
	Name->SetText(Label);
	if (IsSelected) {
		SetSelected();
	}
	else {
		SetUnselected();
	}
}

void USingleTabButtonWidget::SetSelected() {
	BGMask->SetVisibility(ESlateVisibility::SelfHitTestInvisible);
	Name->SetColorAndOpacity(FSlateColor(FLinearColor(0.698f, 0.867f, 1.f, 1.f)));
	BorderBottm->SetBrushColor(FLinearColor(0.698f, 0.867f, 1.f, 0.616f));
}

void USingleTabButtonWidget::SetUnselected() {
	BGMask->SetVisibility(ESlateVisibility::Collapsed);
	Name->SetColorAndOpacity(FSlateColor(FLinearColor(1.f, 1.f, 1.f, 0.4f)));
	BorderBottm->SetBrushColor(FLinearColor(0.f, 0.f, 0.f, 0.f));
}
